import bge

owner = bge.logic.getCurrentController().owner

z=owner.localPosition.z

if z < 5:
    owner.localPosition.z+=.1
    print(z)
else:
    owner.applyRotation([0,0,.1])